<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       var n = parseInt(prompt("请输入一个三位数",100));
       var ge = n % 10, shi = parseInt(n / 10) % 10, bai =parseInt(n / 100);
       alert(n + "各个数位的和: "+(ge + shi + bai));

    </script>
</head>
<body>
    
</body>
</html>